import request from '@/router/axios'
import { baseUrl } from '@/config/env'
import { uploadUrl,dictUrl } from '@/config/env'


export const UploadImage = (param) => {
    console.log(uploadUrl)
    return request.post(uploadUrl, param)
}


//产品列表
export const GetProductList = (param) => {
    return request.get(baseUrl + '/products/index', {
        params: param
      })
}
export const GetProductShow = (param) => {
    return request.get(baseUrl + '/products/'+param.id+'/show', {
        params: param
      })
}

//更新产品的上下架情况
export const UpdateProductSale = (param) => {
    return request.post(baseUrl + '/products/' + param.id + '/sale', param)
}

export const AddOwnProduct = (param) => {
    return request.post(baseUrl + '/products/add_own_product', param)
}


//获取产品的skus列表
export const GetProductSkus= (param) => {
    return request.get(baseUrl + '/products/' + param.id + '/skus', {
        params:param
    })
}

//修改skus的相关属性
export const SetProductSkus= (param) => {
    return request.post(baseUrl + '/products/' + param.id + '/skus', param.data)
}

export const DelProductSku= (param) => {
    return request.post(baseUrl + '/products/del_sku/' + param.id, param)
}

//获取产品库列表
export const GetLibrary= (param) => {
    return request.get(baseUrl + '/products/library', {
        params:param
    })
}

// 添加产品库商品
export const AddLibraryProduct= (param) => {
    return request.post(baseUrl + '/products/library/' + param.id +'/add' , param)
}

// 更新产品的信息
export const UpdateProduct= (param) => {
    return request.post(baseUrl + '/products/' + param.id +'/update' , param)
}

export const AddProductOwnSku= (param) => {
    return request.post(baseUrl + '/products/' + param.id +'/add_sku' , param)
}

//获取订单列表
export const GetOrders= (param) => {
    return request.get(baseUrl + '/orders/', {
        params:param
    })
}

//获取单个订单
export const GetOrderDetail= (param) => {
    return request.get(baseUrl + '/orders/' + param.id + '/detail', {
        params:param
    })
}

// 订单配送预发布
export const GetQueryDeliverFee= (param) => {
    return request.post(baseUrl + '/ship/queryDeliverFee', param)
}

//订单发货
export const ShipOrder= (param) => {
    return request.post(baseUrl + '/orders/' + param.id +'/ship', param)
}

//订单发货配送
export const addAfterQuery= (param) => {
    return request.post(baseUrl + '/ship/addAfterQuery', param)
}

// 订单取消配送
export const CancelOrderFms = (param) => {
    return request.post(baseUrl + '/ship/cancelOrder', param)
}

// 订单重新发布配送
export const reAddOrder= (param) => {
    return request.post(baseUrl + '/ship/reAddOrder', param)
}

//订单取消
export const CancelOrder= (param) => {
    return request.post(baseUrl + '/orders/' + param.id +'/cancel', param)
}


//获取竞标单列表
export const GetBidOrders= (param) => {
    return request.get(baseUrl + '/bid_orders/', {
        params:param
    })
}

// 获取单个竞标单内容
export const GetBidOrdersShow= (param) => {
    return request.get(baseUrl + '/bid_orders/' + param.id, {
    })
}

export const GetMyBidOrders= (param) => {
    return request.get(baseUrl + '/bid_orders/my_orders', {
        params:param
    })
}

// 竞标单出价
export const SetBidPrice= (param) => {
    return request.post(baseUrl + '/bid_orders/' + param.id +'/bid', param)

}

//竞标单订单发货
export const ShipBidOrder= (param) => {
    return request.post(baseUrl + '/bid_orders/' + param.id +'/ship', param)
}
//竞标单订单取消
export const CancelBidOrder= (param) => {
    return request.post(baseUrl + '/bid_orders/' + param.id +'/cancel', param)
}

//获取分类
export const GetCategory= (param) => {
    return request.get(baseUrl + '/categories', {
        params:param
    })
}

//获取流水表
export const GetAsset= (param) => {
    return request.get(baseUrl + '/asset', {
        params:param
    })
}

//获取提现表
export const GetWithdraw= (param) => {
    return request.get(baseUrl + '/withdraw', {
        params:param
    })
}
export const GetWithdrawInfo= (param) => {
    return request.get(baseUrl + '/withdraw/info', {
        params:param
    })
}

//进行提现
export const StoreWithdraw= (param) => {
    return request.post(baseUrl + '/withdraw',param)
}

//获取门店客户
export const GetUserList= (param) => {
    return request.get(baseUrl + '/merchantuser/getList', {
        params:param
    })
}

//返回资金管理汇总信息-订单信息
export const GetFundInfo= (param) => {
    return request.get(baseUrl + '/merchantFund/getFundInfo', {
        params:param
    })
}
//返回资金管理汇总信息-提现记录
export const GetWithdrawRecord= (param) => {
    return request.get(baseUrl + '/merchantFund/getWithdrawRecord', {
        params:param
    })
}

// 获取商家信息
export const GetMerchantInfo= (param) => {
    return request.get(baseUrl + '/merchant/show', {
        params:param
    })
}
// 更新上架信息
export const SetMerchantInfo= (param) => {
    return request.post(baseUrl + '/merchant/update', param)
}
// 绑定银行卡
// 更新上架信息
export const UpdateBankInfo= (param) => {
    return request.post(baseUrl + '/bind_bank', param)
}

export const UpdatePassword= (param) => {
    return request.post(baseUrl + '/password/update', param)
}

export const showOrder = (param) => {
    return request.get(baseUrl + '/showOrder', {
        params:param
    })
}

export const GetOtherOrder = (param) => {
    return request.get(baseUrl + '/getOtherOrder', {
        params:param
    })
}

export const GetMerchantNotification= (param) => {
    return request.get(baseUrl + '/notifications', param)
}

export const makeAsRead= (param) => {
    return request.post(baseUrl + '/makeAsRead', param)
}

export const orderCancelConfirm= (param) => {
    return request.post(baseUrl + '/order/confirmCancel', param)
}
export const bidorderCancelConfirm= (param) => {
    return request.post(baseUrl + '/bid_order/confirmCancel', param)
}
export const orderRefund= (param) => {
    return request.post(baseUrl + '/orders/refundToCustomer', param)
}

export const getDict = (param) => {
    return request.get(dictUrl, {
        params:param
    })
}

export const orderRefundById= (param) => {
    return request.post(baseUrl + '/orders/refund_by_id', param)
}